package com.taijihuabao.modules.enums.optenums.dept;

/**
 * 部门角色枚举
 *
 * @author Tu
 * @date 2022/1/5 13:42
 */
public enum DeptRoleEnum {

    /**
     * 普通职工
     */
    NormalPerson("ordinaryEmployees", "普通职工"),
    /**
     * 主管
     */
    Admin("administrator", "主管"),
    /**
     * 组长(审核员)
     */
    Assessor("assessor", "组长"),
    /**
     * 考勤专员
     */
    CheckInCommissioner("attendanceCommissioner", "考勤专员"),
    /**
     * 人事考勤组
     */
    CheckInPersonnel("personneAttendance", "人事考勤组");


    private final String code;
    private final String message;

    DeptRoleEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 根据状态code获取枚举名称
     *
     * @return
     */
    public static String getMessageByCode(String code) {
        for (DeptRoleEnum status : DeptRoleEnum.values()) {
            if (status.getCode().equals(code)) {
                return status.message;
            }
        }
        return null;
    }

    /**
     * 根据状态code获取枚举值
     *
     * @return
     */
    public static DeptRoleEnum getByCode(String code) {
        for (DeptRoleEnum status : DeptRoleEnum.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

}
